//argument0 - Names generated
//argument1 - Max length
//argument2 - Min length
buffer = "";
name = "";
if (argument1 == -1)
argument1 = 10;

if (argument2 == -1)
argument2 = 3;
    
    //Generate random number first
    pos = irandom(ds_map_size(argument0));
    curpos = ds_map_find_first(argument0);
    
    for (i = 0; i < pos; i+= 1)
    {
        curpos = ds_map_find_next(argument0, curpos);
    }
    
    value = ds_map_find_value(argument0, curpos);
    pos = irandom(ds_list_size(value)-1);
    buffer = ds_list_find_value(value, pos);
    
    name += string_char_at(buffer,1);
    
    while (string_char_at(buffer, 2) != "*")
    {
        value = ds_map_find_value(argument0, buffer);
        pos = irandom(ds_list_size(value)-1);
        buffer = ds_list_find_value(value, pos);

        name += string_char_at(buffer,1);
        
        //Check and remove 3 letter problem
        if (string_char_at(name, string_length(name)) == string_char_at(name, string_length(name)-1))
            if (string_char_at(name, string_length(name)-1) == string_char_at(name, string_length(name)-2))
                {
                    name = string_delete(name, string_length(name)-2, 1);
                }
        
        //To lazy to fix it in code, rather just recall the function
        //if the name is to large.
        if (string_length(name) > argument1)
            return scr_generatenames(argument0, argument1, argument2)
    }

    //Same as above, rather recall if name is to small.
    if (string_length(name) < argument2)
        return scr_generatenames(argument0, argument1, argument2)
        
return name;
